<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <div th:replace="fragments/resourceLink :: resourceLink"></div>
    <link href="../../../resources/css/fileinput.min.css">
    <script type="text/javascript" src="../../../resources/js/fileinput.min.js"></script>
    <script type="text/javascript" src="../../../resources/js/articleList.js"></script>
    <title>manager&articleList</title>
</head>

<body>
<div class="navbar navbar-inverse" th:replace="fragments/header :: header">
    heah
</div>


<!-- Page container -->
<div class="page-container">

    <!-- Page content -->
    <div class="page-content">

        <!-- Main sidebar -->
        <div class="sidebar sidebar-main">
            <div th:replace="fragments/leftmanager :: leftmanager"></div>
        </div>
        <!-- /main sidebar -->


        <!-- Main content -->
        <div class="content-wrapper">

            <!-- Page header -->
            <div class="page-header page-header-default">
                <div class="page-header-content">
                    <div class="page-title">
                        <h3 data-th-text="管理员页面"></h3>
                    </div>

                    <div class="heading-elements">
                        <div class="heading-btn-group hidden">
                            <a href="#" class="btn btn-link btn-float has-text"><i
                                    class="icon-bars-alt text-primary"></i><span>Statistics</span></a>
                            <a href="#" class="btn btn-link btn-float has-text"><i
                                    class="icon-calculator text-primary"></i> <span>Invoices</span></a>
                            <a href="#" class="btn btn-link btn-float has-text"><i
                                    class="icon-calendar5 text-primary"></i> <span>Schedule</span></a>
                        </div>
                    </div>
                </div>

                <div class="breadcrumb-line">
                    <ul class="breadcrumb" style="float: left;">
                        <li class="active"><a href="#"><i class="icon-arrow-right8 position-left"></i>文章列表</a></li>

                    </ul>

                </div>
            </div>
            <!-- /page header -->

            <div class="content">
                <div class="panel">
                    <div class="panel-heading"></div>
                    <div class="panel-body">
                        <div class="middlebody col-md-12 column">

                            <div class="col-md-12 column">
                                <div class="panel-group" id="panel-567310">
                                    <div class="panel panel-default">
                                        <div class="panel-heading">
                                            <a class="panel-title collapsed" data-toggle="collapse"
                                               data-parent="#panel-567310" href="#panel-element-650746">添加</a>
                                        </div>
                                        <div id="panel-element-650746" class="panel-collapse collapse">
                                            <div class="panel-body">
                                                <form id="add" class="form-inline row" >
                                                    <div class="form-group">
                                                        <label for="exampleInput1">标题</label>
                                                        <input type="text" class="form-control" id="exampleInput1" />
                                                    </div>
                                                    <div class="form-group">
                                                        <label for="exampleInput2">作者</label>
                                                        <input  class="form-control" id="exampleInput2" />
                                                    </div>
                                                    <br><br>
                                                    <div class="form-group col-md-12 column">
                                                        <label for="exampleInput2" class="col-md-1 column">内容</label>
                                                        <textarea class="form-control col-md-11 column" id="exampleInput3"
                                                                 style="overflow:auto;width: 300px;margin-bottom: 15px;"></textarea>
                                                    </div>
                                                    <br><br>
                                                    <button type="button" onclick="addarticle()" class="btn btn-default col-md-2 column">Submit</button>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <!--上面搜索栏+排序-->
                            <form  th:href="@{/articleList}" method="post" name="searchform" th:replace="fragments/searchbox :: searchbox"></form>

                            <!--articleList列表表格-->
                            <div class="col-md-12 column">
                                <ul class="nav nav-tabs">
                                    <li class="active"><a href="#tab1" data-toggle="tab">公告列表</a></li>
                                </ul>
                                <div class="tab-content col-lg-12 col-xs-12 col-sm-12 col-md-12">
                                    <div class="tab-pane fade in active" id="tab1">
                                        <div class="row clearfix">
                                            <div class="col-md-12 column">
                                            <table class="table table-striped table-hover">
                                                <thead>
                                                <tr>
                                                    <th>
                                                        <a th:href="@{/articleList?(flag=(${flag} != 4)?4:5,title=${title},num=${num})}"
                                                           class="label label-success">ID</a>
                                                        <i th:class="${flag} == 4?'icon-arrow-up-right3':'hidden'"></i>
                                                        <i th:class="${flag} == 5?'icon-arrow-down-right3':'hidden'"></i>
                                                    </th>
                                                    <th>
                                                        <a th:href="@{/articleList?(flag=(${flag} != 2)?2:3,title=${title},num=${num})}"
                                                           class="label label-success">标题</a>
                                                        <i th:class="${flag} == 2?'icon-arrow-up-right3':'hidden'"></i>
                                                        <i th:class="${flag} == 3?'icon-arrow-down-right3':'hidden'"></i>
                                                    </th>
                                                    <th>
                                                        <a th:href="@{/articleList?(flag=(${flag} != 6)?6:7,title=${title},num=${num})}"
                                                           class="label label-success">作者</a>
                                                        <i th:class="${flag} == 1?'icon-arrow-up-right3':'hidden'"></i>
                                                        <i th:class="${flag} == 0?'icon-arrow-down-right3':'hidden'"></i>
                                                    </th>
                                                    <th>
                                                        <a th:href="@{/articleList?(flag=(${flag} != 0)?0:1,title=${title},num=${num})}"
                                                           class="label label-success">时间</a>
                                                        <i th:class="${flag} == 6?'icon-arrow-up-right3':'hidden'"></i>
                                                        <i th:class="${flag} == 7?'icon-arrow-down-right3':'hidden'"></i>
                                                    </th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                <tr th:each="user,userStat:${articleList}" id="refresh">
                                                    <td th:text="${user.article_id}" class="col-md-1 column">userID</td>
                                                    <td th:text="${user.article_name}" class="col-md-2 column">2016-11-22</td>
                                                    <td th:text="${user.article_author}" class="col-md-2 column"></td>
                                                    <td th:text="${user.article_createTime}" class="col-md-2 column">45</td>
                                                    <td class="col-md-2 column">
                                                        <a class="label label-default"
                                                           th:id="${user.article_id}"
                                                           onclick="deletearticle(this);">删除</a>
                                                        <input type="hidden" th:value="${user.article_name}"/>
                                                        <a class="label label-info"
                                                           th:href="@{showarticle/}+${user.article_id}">详细</a>
                                                    </td>
                                                </tr>
                                                </tbody>
                                            </table>
                                            </div>
                                        </div>
                                        <!--楼下分页-->
                                        <div class="page row clearfix">
                                            <div class="col-md-offset-4 column">
                                                <ul class="pagination pagination-sm">
                                                    <!--前一页-->
                                                    <li><a th:if="${page.currentPage} gt 1"
                                                           th:href="@{/articleList?(currentPage=${page.currentPage-1},flag=${flag},num=${num},title=${title})}">&laquo;</a>
                                                    </li>
                                                    <!--首页-->
                                                    <li th:class="${page.currentPage le 1} ? 'disabled' : ''">
                                                        <a th:if="${page.currentPage != 1}"
                                                           th:href="@{${keywords != null? '/articleList' : '/articleList'}(currentPage=1,keywords=${keywords != null}?${keywords}:'',flag=${flag},num=${num},title=${title})}">首页</a>
                                                        <a th:if="${page.currentPage == 1}" href="javascript:void(0);">首页</a>
                                                    </li>
                                                    <!--动态生成中间的页码格子-->
                                                    <li th:each="pageNo : ${#numbers.sequence(page.currentPage - 3 < 0 ? 0 : page.currentPage - 3, (page.currentPage + 3 > page.totalPage - 3 ? page.totalPage - 1: page.currentPage + 3))}"
                                                        th:class="${page.currentPage eq (pageNo+1)}? 'active' : ''">
                                                        <a th:if="${page.currentPage  eq (pageNo+1)}"
                                                           href="javascript:void(0);">
                                                            <text th:text="${pageNo+1}"></text>
                                                        </a>
                                                        <a th:if="${not (page.currentPage eq (pageNo+1))}"
                                                           th:href="@{${keywords != null ? '/articleList' : '/articleList'}(currentPage=${pageNo+1},keywords=${keywords != null}?${keywords}:'',flag=${flag},num=${num},title=${title})}">
                                                            <text th:text="${pageNo+1}"></text>
                                                        </a>
                                                    </li>
                                                    <!--尾页-->
                                                    <li th:class="${page.currentPage ge page.totalPage} ? 'disabled' : ''">
                                                        <a th:if="${page.currentPage != page.totalPage}"
                                                           th:href="@{${keywords != null? '/articleList' : '/articleList'}(currentPage=${page.totalPage},keywords=${keywords != null}?${keywords}:'',flag=${flag},num=${num},title=${title})}">末页</a>
                                                        <a th:if="${page.currentPage == page.totalPage}"
                                                           href="javascript:void(0);">末页</a>
                                                    </li>
                                                    <!--下一页-->
                                                    <li><a th:if="${page.currentPage} lt ${page.totalPage}"
                                                           th:href="@{/articleList?(currentPage=${page.nextPage},flag=${flag},num=${num},title=${title})}">&raquo;</a>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>

                                </div>
                            </div>
                            <!-- </form>-->
                        </div>

                    </div><!-- panel-body-->
                </div> <!--panel-->
            </div><!-- content-->

            <!--页脚-->
            <div th:replace="fragments/footer :: footer" class="col-lg-12">
                &copy; 2013 The Static Templates
            </div>
        </div>
        <!-- /main content -->

    </div>
    <!-- /page content -->


</div>
<!-- /page container -->


<!-- 模态框（Modal） -->
<div class="modal fade" id="myModalimg" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            </div>
            <div class="modal-body row">
                <img id="showimg" class="img-thumbnail">
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

</body>
</html>
